home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
cstdio.arc
/
SRC.ARC
/
STRCHR.A
< prev
next >
Wrap
Text File
|
1985-08-20
|
638b
|
33 lines
; strchr.a - find first occurrence of character in string.
; (C) Copyright 1985 Cray Research Inc. - All Rights Reserved.
; G. R. Mansfield. 85/08/20.
; Ver 1.0-5820.
cseg
public strchr_
public index_
; char *strchr(s, c) /* return pointer to first occurrence of c */
; char *index(s, c) /* in s NULL if c is not in s */
; char *s;
; int c;
strchr_:
index_:
mov bx,sp
mov si,[bx+2] ; s
mov ah,[bx+4] ; c
stc1: lodsb ; next character in s
or al,al
jz stc2 ; end of string
cmp al,ah
jnz stc1 ; loop if not found
xchg ax,si ; pointer to c
dec ax
ret
stc2: cbw ; null pointer
ret